package design_principles.proxy.code;

import java.text.SimpleDateFormat;
import java.util.Date;

import design_principles.proxy.code.dto.Order;
import design_principles.proxy.code.proxy.OrderServiceSaticProxy;
import design_principles.proxy.code.service.IOrderService;
import design_principles.proxy.code.service.impl.OrderServiceImpl;

/**
 * https://xuanjian1992.top/2019/07/09/Proxy%E5%8A%A8%E6%80%81%E4%BB%A3%E7%90%86%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90/
 */
public class TestMain {
    public static void main(String[] args) {
        try {
            Order order=new Order();
            SimpleDateFormat sdf=new SimpleDateFormat("yyyy/MM/dd");
            Date date= sdf.parse("2017/02/01");
            order.setCreateTime(date.getTime());

            IOrderService orderService=new OrderServiceSaticProxy(new OrderServiceImpl());
            orderService.createOrder(order);
        } catch (Exception e) {
           e.printStackTrace();
        }
        
    }
}